<?php /* @var $this Controller */ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title><?php echo CHtml::encode($this->pageTitle); ?></title>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="language" content="en" />

    <!--[if lt IE 8]>
    <link type="text/css" rel="stylesheet" href="<?php echo Yii::app()->clientScript->minScriptCreateGroup(array(Yii::app()->request->baseUrl.'/css/ie.css')); ?>" />
    <![endif]-->
    <!--[if lt IE 9]>
    <script type="text/javascript" src="<?php echo Yii::app()->clientScript->minScriptCreateGroup(array(Yii::app()->request->baseUrl.'/js/css3-mediaqueries.js')); ?>"></script>
　　<![endif]-->
	
	<?php
	Yii::app()->clientScript->registerCoreScript('jquery');
	Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/css/screen.css'  );
    Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/css/admin.css'  );
    Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/css/form.css'  );
    Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/css/colorbox.css'  ); 
    Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/jquery.colorbox-min.js'); 

	Yii::app()->clientScript->registerScript('menujs', "

		$('.list > li.item > a').click(function(){
			$('.parentactive').each(function( index ) {
				$( this ).removeClass('parentactive');
				$( this ).children('ul').hide('fast');
			});
			
			$(this).next().show('fast');
			$(this).parent().addClass('parentactive');
			return false;
		});

		$('div#menu li.active').parent().toggle();
		$('div#menu li.active').parents('.item').addClass('parentactive');

		$('#sidebar').height($('.span-19').height());

		$('.phonesview').click(function(){ 
	           $('.phonesview').colorbox({
	            href:'".Yii::app()->createUrl('company/comtemplates')."',
	            close: '【关闭】',
	            initialWidth:440,
	            initialHeight:878,
	            width:'440px',
	            height:'878px',
	            title:'预览用户首页' 
	           }); 
	        });  

	");
	?>
</head>

<body>

<div class="container" id="page">
	<div id="headmenu">
		<div id="header">
			<div id="logo"><img src="<?php echo Yii::app()->request->baseUrl; ?>/images/admin/logo.png" /></div>
		</div><!-- header -->

		<div id="mainmenu">
		<?php 


		$this->widget('zii.widgets.CMenu',array(
				'items'=> array(
                    array('label'=>'退出', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest),
                    array('label'=>'论坛', 'url'=>'http://115.28.3.15/bbs/forum.php', 'linkOptions'=>array('target'=>'_blank'), 'visible'=>!Yii::app()->user->isGuest),
                    array('label'=>'帮助说明', 'url'=>'http://115.28.3.15/bbs/forum.php?mod=forumdisplay&fid=41', 'linkOptions'=>array('target'=>'_blank'), 'visible'=>!Yii::app()->user->isGuest),
					array('label'=>'Gii', 'url'=>array('/gii/'), 'visible'=> 0==strcmp(Yii::app()->user->name , 'admin') ),
					array('label'=>'预览用户首页', 'url'=>'javascript:void(0);', 'visible'=>!Yii::app()->user->isGuest,'linkOptions'=>array('class'=>'phonesview')),
					array('label'=>'修改密码','url'=>array('/company/repassword') , 'visible'=> 0!==strcmp(Yii::app()->user->name , 'admin') ),
					array('label'=>'欢迎您 '.Yii::app()->user->name.'', 'url'=>'javascript:void(0);', 'visible'=>!Yii::app()->user->isGuest),
					),
			));

			 ?>
		</div><!-- mainmenu -->
 	</div>

	

	<div class="span-5">
		<div id="sidebar">
		   
		   <div id="menu">
		    <?php 
		 	$item =array();
		    if(Yii::app()->user->name=="admin"){
		 		$item = array( 
	 				array('label'=>'企业', 'url'=>'javascript:'
	 					, 'items' => array(
	 						array('label'=>'查看商家信息', 'url'=>array('/company/admin')),
	 						array('label'=>'新增商家', 'url'=>array('/company/create')),
	 						array('label'=>'查看广告列表', 'url'=>array('/xdvert/admins')),
	 						array('label'=>'添加广告', 'url'=>array('/xdvert/adminCreate')),
							array('label'=>'查看商家分类', 'url'=>array('/tag/admin')),
	 						array('label'=>'新增商家分类', 'url'=>array('/tag/create')),
	 						array('label'=>'发送短信日志', 'url'=>array('/sendsmslog/admin')),
	 						array('label'=>'短信充值记录', 'url'=>array('/smsorders/admins')),
	 						)
	 					),
	 				 
					array('label'=>'路由器',  'url'=>'javascript:'
	 					, 'items' => array(
	 						array('label'=>'路由器地图', 'url'=>array('/gateway/gatewayMap')),
	 						array('label'=>'查看路由器列表', 'url'=>array('/gateway/admin')),
	 						array('label'=>'添加路由器', 'url'=>array('/gateway/create')))
	 					), 
					 
					array('label'=>'用户',  'url'=>'javascript:'
	 					, 'items' => array(
	 						array('label'=>'查看用户列表', 'url'=>array('/user/admin')),
	 						array('label'=>'查看登录日志', 'url'=>array('/connectionlog/admin')),
	 						array('label'=>'查看用户黑名单', 'url'=>array('/companyBlacklist/admin')),
	 						array('label'=>'添加黑名单', 'url'=>array('/companyBlacklist/create')),
	 						)
	 					), 
					

                    array('label'=>'客流统计',  'url'=>'javascript:'
	 					, 'items' => array(
	 						array('label'=>'统计', 'url'=>array('/countAdmin/admin')),
							array('label'=>'最近20天', 'url'=>array('/countAdmin/countDay')),
							array('label'=>'最近12个月', 'url'=>array('/countAdmin/countYear')),
							array('label'=>'手动统计', 'url'=>array('/countAdmin/countpage')),
							array('label'=>'手动统计2.0', 'url'=>array('/stats/countpage')),

							array('label'=>'概况', 'url'=>array('/stats/overview')),
							array('label'=>'路人信息', 'url'=>array('/stats/guest')),
	 						array('label'=>'流失顾客信息', 'url'=>array('/stats/leave')),
	 						
							)
	 					),

                    array('label'=>'多媒体和应用', 'url'=>'javascript:'
	 					, 'items' => array(
	 						array('label'=>'多媒体分类列表', 'url'=>array('/category/admin')),
	 						array('label'=>'添加多媒体分类', 'url'=>array('/category/create')),
	 						array('label'=>'多媒体和应用列表', 'url'=>array('/video/admin')),
	 						array('label'=>'添加多媒体', 'url'=>array('/video/vcreate')),
	 						array('label'=>'添加应用', 'url'=>array('/video/acreate')))
	 					),

                    array('label'=>'管理员',  'url'=>'javascript:'
	 					, 'items' => array(
	 						array('label'=>'管理员列表', 'url'=>array('/admin/admin')),
	 						array('label'=>'添加管理员', 'url'=>array('/admin/create')))
	 					),

	 				
				);
		 	}else{
		 		$company = Company::model()->findByPk(Yii::app()->user->id);   
                $templateid = $company->template;
                $showitems=array();
                 switch ($templateid)
	            {
	                case 0:break;
	                case 1:
	                    $showitems=array('label'=>'视频广告设置', 'url'=>'javascript:'
		 					, 'items' => array( 
		 						array('label'=>'视频广告','url'=>array('/xdvert/movie')), 
					            // array('label'=>'新增视频','url'=>array('/xdvert/mcreate')),  
		 						)
		 					);
	                    break;
	                case 2:
	                    $showitems=array('label'=>'轮播图广告设置', 'url'=>'javascript:'
		 					, 'items' => array( 
					           	array('label'=>'轮播图广告','url'=>array('/xdvert/carousel')),
					            // array('label'=>'新增图片','url'=>array('/xdvert/ccreate')),
		 						)
		 					);
	                    break;
	                case 10:
                      	$showitems=array('label'=>'微门户设置', 'url'=>'javascript:'
		 					, 'items' => array( 
					             array('label'=>'门户轮播图管理','url'=>array('/xdvert/hcarousel')), 
								 array('label'=>'门户新闻公告管理','url'=>array('/article/admin')), 
								 array('label'=>'门户产品管理','url'=>array('/article/padmin')), 
		 						)
		 					);
                    	break;
	                case 11:
                      	$showitems=array('label'=>'微信关注设置', 'url'=>'javascript:'
		 					, 'items' => array( 
					             array('label'=>'微信信息','url'=>array('/companyExtend/weixininfo')), 
		 						)
	 					);
	 					break; 
	 				 case 12:
                      	$showitems=array('label'=>'应用下载设置', 'url'=>'javascript:'
		 					, 'items' => array( 
					             array('label'=>'应用下载信息','url'=>array('/companyExtend/appdownload')), 
		 						)
	 					);
                    	break; 
                     case 13:
                     	$showitems=array('label'=>'微门户设置', 'url'=>'javascript:'
		 					, 'items' => array( 
					             array('label'=>'门户轮播图管理','url'=>array('/xdvert/hcarousel')), 
								 array('label'=>'门户新闻公告管理','url'=>array('/article/admin')),  
		 						)
		 					);
                     	break;
                     case 14:
                      	$showitems=array('label'=>'微门户设置', 'url'=>'javascript:'
		 					, 'items' => array(  
								 array('label'=>'推荐视频','url'=>array('/xdvert/removie')),  
		 						)
		 					);
                    	break;
	                default: ;
	            }
		 		$item = array(   
		 			array('label'=>'基本信息设置', 'url'=>'javascript:'
	 					, 'items' => array( 
	 						array('label'=>'基本信息','url'=>array('/company/view')),   
	 						array('label'=>'用户登陆模板','url'=>array('/company/loginTemplates')),   
				            array('label'=>'登陆成功页面','url'=>array('/company/portal')),   
	 						)
	 					),  
		 			$showitems, 
					array('label'=>'顾客营销',  'url'=>'javascript:'
	 					, 'items' => array(
	 						array('label'=>'顾客管理', 'url'=>array('/user/list')), 
    						array('label'=>'顾客黑名单', 'url'=>array('/companyBlacklist/admin')), 
    						array('label'=>'短信营销', 'url'=>array('/smsmarket/admin')),
	 						array('label'=>'短信发送记录', 'url'=>array('/sendsmslog/admin')),
	 						array('label'=>'短信充值','url'=>array('/company/recharge')),
	 						array('label'=>'充值记录', 'url'=>array('/smsorders/admin')),   
	 						)
	 					),  
                    array('label'=>'客流统计',  'url'=>'javascript:'
	 					, 'items' => array(
	 						array('label'=>'概况信息', 'url'=>array('/stats/overview')),
	 						array('label'=>'路人信息', 'url'=>array('/stats/guest')),
	 						array('label'=>'流失顾客信息', 'url'=>array('/stats/leave')),
	 						// array('label'=>'统计', 'url'=>array('/countAdmin/company')),
							array('label'=>'最近20天', 'url'=>array('/countAdmin/companyCountDay')),
							array('label'=>'最近12个月', 'url'=>array('/countAdmin/companyCountYear')), 
							array('label'=>'详细数据', 'url'=>array('/connectionlog/admin')), 
							array('label'=>'查看路由器列表', 'url'=>array('/gateway/admin')),   

							)
	 					),
				);
		 	}
		 	$this->widget('zii.widgets.CMenu',array(
				'items'=>$item,
				'itemCssClass' => 'item',
				'htmlOptions' => array('class'=>'list'),
				'submenuHtmlOptions' => array('class'=>'sublist'), 
			)); ?>
			</div>
		<?php
			// $this->beginWidget('zii.widgets.CPortlet', array(
			// 	'title'=>'操作',
			// ));
			// $this->widget('zii.widgets.CMenu', array(
			// 	'items'=>$this->menu,
			// 	'htmlOptions'=>array('class'=>'operations'),
			// ));
			// $this->endWidget();
		?>
		</div><!-- sidebar -->
	</div>
	<div class="span-19 last">
		<div id="content">
			<?php echo $content; ?>
		</div><!-- content -->
		<div class="clear"></div>
	</div>


	<div class="clear"></div>

	<div id="footer">
		Copyright &copy; <?php echo date('Y'); ?> by 云客来 v<?php echo Yii::app()->params['version']; ?><br/>
		All Rights Reserved.<br/>
		 
	</div><!-- footer -->

</div><!-- page -->
<div class="iespace"></div>
</body>
</html>
